﻿using System;
using System.Collections.Generic;
using SobrietyEngine.Assets;

namespace SobrietyEngine.Common
{
    public abstract class BaseStringDataReader
    {
        public T Load<T>(String assetName, IAssetGameService ags)
        {
            String data = ags.Load<String>(assetName);
            return Parse<T>(ReadData(ProcessData(data)));
        }

        public virtual String ProcessData(String data)
        {
            return data;
        }

        public StringData ReadData(String data)
        {
             return StringData.ReadData(ref data);
        }

        public abstract T Parse<T>(StringData sd);
    }
}
